/****************************************Copyright (c)**************************************************
**                                         2016-03
**
**                                
**
**
**--------------File Info-------------------------------------------------------------------------------
** File name:		    ht6x1x_misc.h
** Last modified Date:  2016-03-29
** Last Version:		v1.0
** Descriptions:		
**
**------------------------------------------------------------------------------------------------------
** Created by:			Evan Chen
** Created date:		2016-03-29
** Version:				v1.0
** Descriptions:		
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HT6X1X_MISC_H
#define __HT6X1X_MISC_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "ht60xx.h"

/*WAKEIF*/
#define WAKEIF_WDTWKIF_MASK      	((uint32_t)0x00800000)
#define WAKEIF_RTCWKIF_MASK      	((uint32_t)0x00100000)
#define WAKEIF_TBSWKIF_MASK      	((uint32_t)0x00080000)
#define WAKEIF_RX5WKIF_MASK      	((uint32_t)0x00004000)
#define WAKEIF_RX4WKIF_MASK      	((uint32_t)0x00002000)
#define WAKEIF_RX3WKIF_MASK      	((uint32_t)0x00001000)
#define WAKEIF_RX2WKIF_MASK      	((uint32_t)0x00000800)
#define WAKEIF_RX1WKIF_MASK      	((uint32_t)0x00000400)
#define WAKEIF_RX0WKIF_MASK      	((uint32_t)0x00000200)
#define WAKEIF_INT6WKIF_MASK      	((uint32_t)0x00000100)
#define WAKEIF_INT5WKIF_MASK      	((uint32_t)0x00000080)
#define WAKEIF_INT4WKIF_MASK      	((uint32_t)0x00000040)
#define WAKEIF_INT3WKIF_MASK      	((uint32_t)0x00000020)
#define WAKEIF_INT2WKIF_MASK      	((uint32_t)0x00000010)
#define WAKEIF_INT1WKIF_MASK      	((uint32_t)0x00000008)
#define WAKEIF_INT0WKIF_MASK      	((uint32_t)0x00000004)
#define WAKEIF_PMUWKIF_MASK      	((uint32_t)0x00000001)

typedef enum
{
  	MISC_Wakeup_WDTWKIF = WAKEIF_WDTWKIF_MASK,
	MISC_Wakeup_RTCWKIF = WAKEIF_RTCWKIF_MASK,
	MISC_Wakeup_TBSWKIF = WAKEIF_TBSWKIF_MASK,
	MISC_Wakeup_RX5WKIF = WAKEIF_RX5WKIF_MASK,
	MISC_Wakeup_RX4WKIF = WAKEIF_RX4WKIF_MASK,
	MISC_Wakeup_RX3WKIF = WAKEIF_RX3WKIF_MASK,
	MISC_Wakeup_RX2WKIF = WAKEIF_RX2WKIF_MASK,
	MISC_Wakeup_RX1WKIF = WAKEIF_RX1WKIF_MASK,
	MISC_Wakeup_RX0WKIF = WAKEIF_RX0WKIF_MASK,
	MISC_Wakeup_INT6WKIF = WAKEIF_INT6WKIF_MASK,
	MISC_Wakeup_INT5WKIF = WAKEIF_INT5WKIF_MASK,
	MISC_Wakeup_INT4WKIF = WAKEIF_INT4WKIF_MASK,
	MISC_Wakeup_INT3WKIF = WAKEIF_INT3WKIF_MASK,
	MISC_Wakeup_INT2WKIF = WAKEIF_INT2WKIF_MASK,
	MISC_Wakeup_INT1WKIF = WAKEIF_INT1WKIF_MASK,
	MISC_Wakeup_INT0WKIF = WAKEIF_INT0WKIF_MASK,
	MISC_Wakeup_PMUWKIF = WAKEIF_PMUWKIF_MASK
}MISC_Wakeup_TypeDef;


void MISC_GotoSleepMode(void);
void MISC_GotoHoldMode(void);
void MISC_Enable_Interrupt(void);
void MISC_Disable_Interrupt(void);
void MISC_SystemReset(void);
uint32_t MISC_WakeupState(MISC_Wakeup_TypeDef type);
void MISC_EnableIRQs(uint32_t irqs);
void MISC_DisableIRQs(uint32_t irqs);

#ifdef __cplusplus
}
#endif

#endif /* __HT6X1X_MISC_H */

